CREATE PROCEDURE SP_CREATE_UPDATE_ASSEMBLY_RELEASE_LOT_SIZE_MAX_QTY
@PROCESSSTEP_ID		INT,
@DPW			INT,
@MAX_LOT_SIZE		INT,
@NO_OF_WAFERS_PER_LOT   INT
AS 
BEGIN
	DECLARE @COUNT   INT
	
	SELECT @COUNT= COUNT(*) FROM ASSEMBLY_RELEASE_LOT_SIZE_MAX_QTY_TABLE WHERE PROCESSSTEP_ID=@PROCESSSTEP_ID
	
	IF (@COUNT> 0)
		BEGIN
			 UPDATE ASSEMBLY_RELEASE_LOT_SIZE_MAX_QTY_TABLE SET DPW= @DPW, MAX_LOT_SIZE= @MAX_LOT_SIZE, NO_OF_WAFERS_PER_LOT = @NO_OF_WAFERS_PER_LOT, TIMESTAMP= CURRENT_TIMESTAMP WHERE PROCESSSTEP_ID=@PROCESSSTEP_ID
		END
	ELSE
		BEGIN
			INSERT INTO ASSEMBLY_RELEASE_LOT_SIZE_MAX_QTY_TABLE (PROCESSSTEP_ID, DPW, MAX_LOT_SIZE, NO_OF_WAFERS_PER_LOT, TIMESTAMP) VALUES(@PROCESSSTEP_ID, @DPW, @MAX_LOT_SIZE, @NO_OF_WAFERS_PER_LOT, CURRENT_TIMESTAMP  )
		END
	
END